<template>
    <div>

       <detail-banner :list="list" :blength="blength"></detail-banner>
       <keep-alive><detail-header></detail-header></keep-alive>
       <detail-list :list="list.categoryList"></detail-list>
       <div class="content"></div>
    </div>
</template>

<script>
import DetailBanner from './components/banner.vue'
import DetailHeader from './components/header.vue'
import DetailList from './components/list.vue'
import axios from 'axios'
export default {
  name: 'Detail',
  components: {
    DetailBanner,
    DetailHeader,
    DetailList
  },
  data () {
    return {
      list: {},
      blength: null
    }
  },
  methods: {
    getDetailInfo () {
      axios.get('/api/detail.json', {
        params: {
          id: this.$route.params.id
        }
      })
        .then(this.getDetailInfoSucc)
    },
    getDetailInfoSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.list = data
        this.blength = data.gallaryImgs.length
      }
    }
  },
  mounted () {
    this.getDetailInfo()
  }

}
</script>

<style lang="stylus" scoped>
 .content
  height:50rem
</style>
